import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    openSider: true,
    selections: [],
    permissions: []
  },
  mutations: {
    setOpenSider(state, newVal) {
      state.openSider = newVal
    },
    setPermissions(state, payload) {
      state.permissions = []
      state.permissions.push(...payload)
    }
  },
  getters: {
    getOpenSider: state => {
      return state.openSider
    },
    getPermissions: state => {
      return state.permissions
    }
  }
})

export default store
